package com.ssy.lingxi.member.merchant.repository;


import com.ssy.lingxi.member.merchant.entity.MenuDO;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * 业务平台 - 菜单数据库操作JpaRepository
 * @author 万宁
 * @date 2020-06-15
 * @version 2.0.0
 */
@Repository
public interface MenuRepository extends JpaRepository<MenuDO, Long>, JpaSpecificationExecutor<MenuDO> {
    Boolean existsByUrlAndSource(String url, Integer source);

    Boolean existsByUrlAndSourceAndPaasIdNot(String url, Integer source, Long paaSId);

    MenuDO findFirstByPaasId(Long paasId);

    MenuDO findFirstByIdAndSource(Long id, Integer source);

    List<MenuDO> findBySource(Integer source);

    List<MenuDO> findByIdInAndSourceNot(List<Long> ids, Integer source);

    Boolean existsByUrlAndSourceAndIdNot(String url, Integer source, Long id);
}
